package com.jeesite.modules.sys.interceptor;

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

//package com.jeesite.modules.config.service.interceptor;

import com.jeesite.common.config.Global;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.modules.sys.interceptor.MobileInterceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@EnableWebMvc
@ConditionalOnProperty(
        name = {"service.interceptor.mobile.enabled"},
        havingValue = "true",
        matchIfMissing = true
)
public class MobileViewInterceptorConfig implements WebMvcConfigurer {
    public MobileViewInterceptorConfig() {
    }

    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(new MobileInterceptor());
        String apps = Global.getProperty("service.interceptor.mobile.addPathPatterns");
        String epps = Global.getProperty("service.interceptor.mobile.excludePathPatterns");
        String[] var5 = StringUtils.split(apps, ",");
        int var6 = var5.length;

        int var7;
        String uri;
        for(var7 = 0; var7 < var6; ++var7) {
            uri = var5[var7];
            if (StringUtils.isNotBlank(uri)) {
                registration.addPathPatterns(new String[]{StringUtils.trim(uri)});
            }
        }

        var5 = StringUtils.split(epps, ",");
        var6 = var5.length;

        for(var7 = 0; var7 < var6; ++var7) {
            uri = var5[var7];
            if (StringUtils.isNotBlank(uri)) {
                registration.excludePathPatterns(new String[]{StringUtils.trim(uri)});
            }
        }

    }
}
